/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package jp.co.irep.juten.facade;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.ParameterExpression;
import javax.persistence.criteria.Root;
import jp.co.irep.juten.entity.OrderTbl;

/**
 *
 * @author toan_nguyen
 */
@Stateless
public class OrderTblFacade extends AbstractFacade<OrderTbl> {
    @PersistenceContext(unitName = "JutenPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public OrderTblFacade() {
        super(OrderTbl.class);
    }
    
    public OrderTbl searchByMakerNo(){
        CriteriaBuilder criteriaBuilder = getEntityManager().getCriteriaBuilder();
        CriteriaQuery<OrderTbl> criteriaQuery = criteriaBuilder.createQuery(OrderTbl.class);
        Root<OrderTbl> orderTblRoot = criteriaQuery.from(OrderTbl.class);
        criteriaQuery.select(orderTblRoot);
        ParameterExpression<Integer> makerNo = criteriaBuilder.parameter(Integer.class);
        //criteriaQuery.where(criteriaBuilder.gt(orderTblRoot.get("makerNo"), makerNo));
        return null;
    }
}
